<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>CSS 转换 - 立体呈现</title>
  <style>
    body {
      padding: 0 40px;
    }

    .box {
      width: 600px;
      padding: 50px 0;
      border: 1px solid #ccc;
    }

    .cube {
      width: 200px;
      height: 200px;
      transition: 10s;

      position: relative;

      transform-style: preserve-3d;
      perspective: 1000px;
    }

    .box:hover .cube {
      transform: rotateY(180deg);
    }

    .cube > div {
      position: absolute;
      left: 0;
      right: 0;

      width: 100%;
      height: 100%;
      text-align: center;
      line-height: 200px;
      font-size: 40px;
    }

    .cube .front {
      background-color: pink;
    }

    .cube .back {
      background-color: red;

      transform: translateZ(20px);
    }

  </style>
</head>
<body>
  <h3>3d转换之3d呈现</h3>
  <p>使子盒子置于真正的3d空间内</p>

  <div class="box">
    <div class="cube">
      <div class="front">前面</div>
      <div class="back">后面</div>
    </div>
  </div>
</body>
</html>